package net.starwifi.duobao.web;


import net.starwifi.duobao.mvc.Order;
import net.starwifi.duobao.mvc.PageView;
import net.starwifi.duobao.service.GglUserService;

import net.starwifi.duobao.utils.times.DateTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;


import javax.servlet.http.HttpServletRequest;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * Controller - member.
 *
 * @author ruoo
 * @version 1.0
 */
@Controller("adminggluserController")
@RequestMapping("/ggluser")
public class GglUserController extends BaseController {

    @Autowired
    GglUserService gglUserService;


    /**
     * 列表
     */
    @RequestMapping(value = "/list", method = RequestMethod.GET)
    public String list(PageView pageView, ModelMap model,HttpServletRequest request) {
        pageView.filterQuery(request);
        pageView.addOrder(Order.desc("id"));
        DateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        model.addAttribute("currentDate",format.format(new Date()));
        Date beginData= DateTool.setHms(new Date(), 0, 0, 0);
        Date endData= DateTool.setHms(new Date(),23,59,59);
        model.addAttribute("beginData", beginData);
        model.addAttribute("endData", endData);
        model.addAttribute("page", gglUserService.getScrollData(pageView));
        return "/ggluser/list";
    }


}
